package analyzer.pcap;

import analyzer.Common;

import java.io.FileInputStream;
import java.io.IOException;
/**
 * Pcap Header
 * Magic 4B
 * Major 2B
 * Minor 2B
 * ThisZone 4B
 * SigFigs 4B
 * SnapLen 4B
 * LinkType 4B
 */

public class Pcap {
    public static void analye(FileInputStream in){
        readMagic(in);
        readMajor(in);
        readMinor(in);
        readThisZone(in);
        readSigFigs(in);
        readSnapLen(in);
        readLinkType(in);
    }
    private static void readMagic(FileInputStream in)
    {
        byte[] b = Common.magic;
        try {
            in.read(b);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static void readMajor(FileInputStream in)
    {
        byte[] b = new byte[2];
        try {
            in.read(b);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static void readMinor(FileInputStream in)
    {
        byte[] b = new byte[2];
        try {
            in.read(b);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static void readThisZone(FileInputStream in)
    {
        byte[] b = new byte[4];
        try {
            in.read(b);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static void readSigFigs(FileInputStream in)
    {
        byte[] b = new byte[4];
        try {
            in.read(b);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static void readSnapLen(FileInputStream in)
    {
        byte[] b = new byte[4];
        try {
            in.read(b);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static void readLinkType(FileInputStream in)
    {
        byte[] b = new byte[4];
        try {
            in.read(b);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
